Repository navigation
fix(node-sdk): flush plugin state through its writable handle on Windows - #230
Merged
Merged
Conversation
WhiteZeek
marked this pull request as ready for review
November 30, 2026 01:08
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
Closes #229
PR 类型 / Type
改动说明 / What changes
复现与根因
Windows 上,Node 插件调用
StateStore.write保存合法值时会在替换目标文件之前收到EPERM。原实现先按路径写完临时文件,再以只读模式重新打开它,并在这个句柄上调用fsyncSync。改动
以
w模式和原有的0o600权限打开临时文件。把 JSON 写入这个句柄,随后用它刷新到磁盘。现有的finally负责关闭句柄,之后执行原子重命名。Windows CI 使用 Node.js 20 运行已有的
support.test.mjs,覆盖状态写入、重新打开和原值保留。Node SDK 或该工作流发生改动时,进入评审的 PR 和main推送都会触发检查。范围检查 / Scope checks
验证 / Verification
环境为 Windows 11 build 22631 x64、Node.js v20.20.2 和 v24.14.0、NTFS。
node --test --test-name-pattern "state store" shared/plugins/sdk/node/test/support.test.mjsmain基线 1 项通过、2 项因fsync EPERM失败。修复后 3 项全部通过。shared/plugins/sdk/node运行node --test --test-concurrency=1 --test-timeout=60000 test/*.test.mjsthe_node_sdk_sample_backend_serves_build_requests_and_plugin_functionsnode --test shared/plugins/sdk/node/test/support.test.mjs(Node.js v20.20.2)main的两个状态写盘用例报EPERM。同机运行本 PR,11 项通过、4 项平台跳过、0 项失败。actionlint1.7.12 和git diff --check提交前确认 / Final checks
main建分支,以 Draft 提交。